package com.coolingme.demo.service.impl;

import com.coolingme.demo.service.DemoService;
import com.coolingme.demo.service.HelloService;
import com.coolingme.springframework.annotation.MeAutowired;
import com.coolingme.springframework.annotation.MeService;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author wangyue
 * @date 2024/08/29 23:23
 */
@MeService
public class HelloServiceImpl implements HelloService {

    @MeAutowired
    private DemoService demoService;

    @Override
    public String hello(String name) {
        return this.demoService.hello("你好！" + name);
    }

    @Override
    public String bye() {
        return " Bye!";
    }

    @Override
    public String query(String name) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = sdf.format(new Date());
        String json = "{name:\"" + name + "\",time:\"" + time + "\"}";
        System.out.println("这是在业务方法中打印的：" + json);
        return json;
    }
}
